package org.example.testCallable;

import java.util.concurrent.*;

public class TestCallable {
    public static void main(String[] args) throws ExecutionException, InterruptedException {



        myCallable callable = new myCallable();
        FutureTask<Integer> futureTask = new FutureTask<>(callable);
        new Thread(futureTask,"A").start();
      //  new Thread(futureTask,"B").start();

        Integer integer = futureTask.get();
        System.out.println(integer);

//         ExecutorService pool = Executors.newFixedThreadPool(3);
//            pool.submit(new myCallable());
//            // 池子肯定要关闭


//        pool.shutdownNow();

    }

}
class myCallable implements Callable<Integer>{

    @Override
    public Integer call() throws Exception {
        System.out.println("hello，callAble");
        return 1024;
    }
}
